From: kfraser@localhost.localdomain Date: Mon, 23 Oct 2006 10:46:41 +0000 (+0100) Subject: [HVM] No need to call hvm_do_resume() on every vm entry. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15585^2~21 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=9464d73f66aebdd4a266d18b2eccb8b99f77de23;p=xen.git [HVM] No need to call hvm_do_resume() on every vm entry. Original patch from Xin Li Signed-off-by: Keir Fraser --- diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 34afeb46e6..c3b0568803 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -237,12 +237,17 @@ void hvm_do_resume(struct vcpu *v) } p = &get_vio(v->domain, v->vcpu_id)->vp_ioreq; - wait_on_xen_event_channel(v->arch.hvm.xen_port, + wait_on_xen_event_channel(v->arch.hvm_vcpu.xen_port, p->state != STATE_IOREQ_READY && p->state != STATE_IOREQ_INPROCESS); - if ( p->state == STATE_IORESP_READY ) + switch ( p->state ) + { + case STATE_IORESP_READY: hvm_io_assist(v); - if ( p->state != STATE_INVALID ) { + break; + case STATE_INVALID: + break; + default: printf("Weird HVM iorequest state %d.\n", p->state); domain_crash(v->domain); } diff --git a/xen/arch/x86/hvm/platform.c b/xen/arch/x86/hvm/platform.c index e52464c0dc..047bb56931 100644 --- a/xen/arch/x86/hvm/platform.c +++ b/xen/arch/x86/hvm/platform.c @@ -727,7 +727,8 @@ static void hvm_send_assist_req(struct vcpu *v) domain_crash(v->domain); return; } - wmb(); + + prepare_wait_on_xen_event_channel(v->arch.hvm_vcpu.xen_port); p->state = STATE_IOREQ_READY; notify_via_xen_event_channel(v->arch.hvm_vcpu.xen_port); } diff --git a/xen/arch/x86/hvm/svm/x86_32/exits.S b/xen/arch/x86/hvm/svm/x86_32/exits.S index a2714030fd..36fa80b680 100644 --- a/xen/arch/x86/hvm/svm/x86_32/exits.S +++ b/xen/arch/x86/hvm/svm/x86_32/exits.S @@ -139,9 +139,6 @@ svm_stgi_label: ENTRY(svm_asm_do_resume) svm_test_all_events: GET_CURRENT(%ebx) - pushl %ebx - call hvm_do_resume - addl $4, %esp /*test_all_events:*/ xorl %ecx,%ecx notl %ecx diff --git a/xen/arch/x86/hvm/svm/x86_64/exits.S b/xen/arch/x86/hvm/svm/x86_64/exits.S index 11c62f9d9e..823c02378d 100644 --- a/xen/arch/x86/hvm/svm/x86_64/exits.S +++ b/xen/arch/x86/hvm/svm/x86_64/exits.S @@ -153,8 +153,6 @@ svm_stgi_label: ENTRY(svm_asm_do_resume) svm_test_all_events: GET_CURRENT(%rbx) - movq %rbx, %rdi - call hvm_do_resume /*test_all_events:*/ cli # tests must not race interrupts /*test_softirqs:*/ diff --git a/xen/arch/x86/hvm/vmx/x86_32/exits.S b/xen/arch/x86/hvm/vmx/x86_32/exits.S index 6b6c553694..d0ef963b86 100644 --- a/xen/arch/x86/hvm/vmx/x86_32/exits.S +++ b/xen/arch/x86/hvm/vmx/x86_32/exits.S @@ -97,9 +97,6 @@ vmx_process_softirqs: ALIGN ENTRY(vmx_asm_do_vmentry) GET_CURRENT(%ebx) - pushl %ebx - call hvm_do_resume - addl $4, %esp cli # tests must not race interrupts movl VCPU_processor(%ebx),%eax diff --git a/xen/arch/x86/hvm/vmx/x86_64/exits.S b/xen/arch/x86/hvm/vmx/x86_64/exits.S index e7084ebc4c..275e8938b2 100644 --- a/xen/arch/x86/hvm/vmx/x86_64/exits.S +++ b/xen/arch/x86/hvm/vmx/x86_64/exits.S @@ -106,8 +106,6 @@ vmx_process_softirqs: ALIGN ENTRY(vmx_asm_do_vmentry) GET_CURRENT(%rbx) - movq %rbx, %rdi - call hvm_do_resume cli # tests must not race interrupts movl VCPU_processor(%rbx),%eax diff --git a/xen/include/xen/event.h b/xen/include/xen/event.h index 6817681e7d..39bb8031ca 100644 --- a/xen/include/xen/event.h +++ b/xen/include/xen/event.h @@ -70,4 +70,11 @@ void notify_via_xen_event_channel(int lport); do_softirq(); \ } while ( 0 ) +#define prepare_wait_on_xen_event_channel(port) \ + do { \ + set_bit(_VCPUF_blocked_in_xen, ¤t->vcpu_flags); \ + raise_softirq(SCHEDULE_SOFTIRQ); \ + mb(); /* set blocked status /then/ caller does his work */ \ + } while ( 0 ) + #endif /* __XEN_EVENT_H__ */